import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
const login = ()=>import('../pages/login.vue')
const index = ()=>import('../pages/index/index')
const menuList = ()=>import('../pages/menu/menuList')
const menuDetail = ()=>import('../pages/menu/menuDetail')
const adminList = ()=>import('../pages/admin/adminList')
const adminDetail = ()=>import('../pages/admin/adminDetail')
const roleList = ()=>import('../pages/role/roleList')
const roleDetail = ()=>import('../pages/role/roleDetail')
const cateList = ()=>import('../pages/cate/cateList')
const cateDetail = ()=>import('../pages/cate/cateDetail')
const home = ()=>import('../pages/home')

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      meta: {
        title: '登录'
      }
    },
    {
      path: '/index',
      name: 'index',
      component: index,
      children: [
        // 首页
        {path: 'index', component: home, meta: {title: '首页'}},
        // 菜单列表页面
        {path: 'menuList', component: menuList, meta: {title: '菜单列表'}},
        // 菜单新增页面
        {path: 'menuList/add', component: menuDetail, meta: {title: '菜单添加'}},
        // 菜单修改页面
        {path: 'menuList/:id', component: menuDetail, meta: {title: '菜单修改'}},
        // 管理员列表页面
        {path: 'adminList', component: adminList, meta: {title: '管理员列表'}},
        // 管理员新增页面
        {path: 'adminList/add', component: adminDetail, meta: {title: '管理员添加'}},
        // 管理员修改页面
        {path: 'adminList/:id', component: adminDetail, meta: {title: '管理员修改'}},
        // 角色列表页面
        {path: 'roleList', component: roleList, meta: {title: '角色列表'}},
        // 角色新增页面
        {path: 'roleList/add', component: roleDetail, meta: {title: '角色添加'}},
        // 角色修改页面
        {path: 'roleList/:id', component: roleDetail, meta: {title: '角色修改'}},
        // 角色列表页面
        {path: 'cateList', component: cateList, meta: {title: '商品分类列表'}},
        // 角色新增页面
        {path: 'cateList/add', component: cateDetail, meta: {title: '商品分类添加'}},
        // 角色修改页面
        {path: 'cateList/:id', component: cateDetail, meta: {title: '商品分类修改'}},
      ]
    }]
})
